﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using Vision;
using Vision.src;

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            // 运行视觉工程的代码
            Thread thread = new Thread(() =>
            {
                Vision.Program.Main();
            });
            thread.SetApartmentState(ApartmentState.STA); // 设置线程为 STA
            thread.Start();

            // 圆查找
            circleEvent circleEvent = new circleEvent();
            Form1.circleFind.Order += circleEvent.Action;

            // 直线查找
            lineEvent lineEvent = new lineEvent();
            Form1.lineFind.Order += lineEvent.Action;
            // 边缘交点
            caliperEvent caliperEvent = new caliperEvent();
            Form1.caliperCorner.Order += caliperEvent.Action;

        }
    }

    public class circleEvent
    {
        internal void Action(CircleFind circlefind, CircleFindEventArgs e)
        {
            Console.WriteLine(e.CenterX);
            Console.WriteLine(e.CenterY);
        }
    }

    public class lineEvent
    {
        internal void Action(LineFind linefind, LineFindEventArgs e)
        {
            Console.WriteLine(e.StartPointX);
            Console.WriteLine(e.StartPointY);
            Console.WriteLine(e.EndPointX);
            Console.WriteLine(e.EndPointY);
            Console.WriteLine(e.LineAngle);
        }
    }

    public class caliperEvent
    {
        internal void Action(CaliperCorner CaliperCorner, CaliperCornerEventArgs e)
        {
            Console.WriteLine(e.CaliperCornerX);
            Console.WriteLine(e.CaliperCornerY);
        }
    }

}
